<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    var data = {name:'haha2',age:11}
    var url = "./data/getData.txt"
    //转换成
    // surl = "./data/getData.txt?name=haha2&age=11"

    var url = url+'?'
    // console.log(url);

    let aff =  JSON.stringify(data)
    for(let key in data){

        console.log(data);
        console.log(key);

        url += aff.replace(":","=")
        
        // console.log(url);
        // console.log(key);
    }

    console.log(url);

    // let att = str.replace(":",'=').replace(',','&').replace(':','=')
    // console.log(att);

    


</script>